<?php


class Services extends BaseObject {
	protected static $instance = null;
	protected function __construct() {
	}
	public function getInstance() {
		if(null === self::$instance) {
			self::$instance = new self();
		}
		return self::$instance;
	}
	public function load() {
		$svcFiles  = glob('svc/*.php');
		
		foreach($svcFiles as $svcFile) {
			if(is_readable($svcFile)) {
				require_once($svcFile);
				preg_match('|([\w]+)\.php$|',$svcFile,$m);
				$svcClass = $m[1];
				$svc = new $svcClass();
			} else {
				throw new Exception('Cannot read service file', 500);
			}
		}
	}
}
